/********************************
 * ETK - Easy ToolKit
 * Copyright (C) 2007-2008 Ekinoks (scv.ekinoks@gmail.com)
 * All rights reserved.
 *
 *    This file is part of ETK.
 *
 *    Foobar is free software; you can redistribute it and/or modify
 *    it under the terms of the GNU General Public License as published by
 *    the Free Software Foundation; either version 2 of the License, or
 *    (at your option) any later version.
 *
 *    Foobar is distributed in the hope that it will be useful,
 *    but WITHOUT ANY WARRANTY; without even the implied warranty of
 *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *    GNU General Public License for more details.
 *
 *    You should have received a copy of the GNU General Public License
 *    along with Foobar; if not, write to the Free Software
 *    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 *
 ***********************************************************************************/

#include "ToolKit.h"

#include "../../Event/EventScroll/EventScroll.h"
#include "../../Event/EventButton/EventButton.h"
#include "../../Event/EventKey/EventKey.h"
#include "../../State/State.h"


#include <wchar.h>



namespace etk
{
    void* ToolKit::getPWIDGET(const RWidget* rWidget) const
    {
        return rWidget->value_;
    }

    void ToolKit::setState(State &state, long int li) const
    {
        state.state_ = li;
    }

    void ToolKit::setButton(ShutterButtonModel &s, int button) const
    {
        s.button_ = button;
    }

    void ToolKit::setEventType(ShutterButtonModel &s, int eventType) const
    {
        s.eventType_ = eventType;
    }

    void ToolKit::setDirection(ShutterScrollModel &s, int direction) const
    {
        s.direction_ = direction;
    }

    void ToolKit::setKeyCode(ShutterKeyModel &s, int keyCode) const
    {
        s.keyCode_ = keyCode;
    }

    void ToolKit::setCharacter(ShutterKeyModel &s, char* string) const
    {
        /*
        wchar_t wct=0;

        for(int i=0; string[i] != 0; i++)
        {
            if(i!=0)
                wct = wct << 8;
            wct |= (string[i]&0xFF);
printf("%d\n", i);
            assert(i<4 && "string is not 1 character");
        }

        if(wct == 'é')
            printf("ok\n");
*/
        std::string st(string);

        s.characters_ = st;
    }
}

